﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="game.aspx.cs" Inherits="Website.game"
    MasterPageFile="~/frag.Master" %>

<%@ Register Assembly="Facebook.Web" Namespace="Facebook.Web.FbmlControls" TagPrefix="cc1" %>
<%@ MasterType VirtualPath="~/frag.Master" %>
<%@ Register Src="BoardUI.ascx" TagName="Board" TagPrefix="uc1" %>
<asp:Content ID="HeadContent" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .directionsTable
        {
            text-align: center;
        }
        fieldset
        {
            width: 0px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:Table ID="Table2" runat="server" CellPadding="10" GridLines="Vertical" HorizontalAlign="Center">
                <asp:TableRow>
                    <asp:TableCell>
                        <asp:UpdatePanel ID="upnlBoard" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <uc1:Board ID="Board1" runat="server" Align="Center" />
                     
             
                    
                     
                     
                     
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </asp:TableCell>
                    <asp:TableCell VerticalAlign = "Top">
                        <asp:HyperLink ID="HyperLink1" NavigateUrl ="~/Help.htm" runat="server" Target="_blank" >Help</asp:HyperLink>
                        <br />
                        <asp:UpdatePanel ID="upnlLables" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Label ID="Label1" runat="server" Text="Current player is: "></asp:Label>
                                &nbsp;<asp:Label ID="lbCurrentPlayer" runat="server" Text="Player"></asp:Label>
                                <br />
                                <asp:Label ID="Label2" runat="server"  Text="Moves: "></asp:Label>
                                &nbsp;&nbsp;&nbsp;
                                <asp:Label ID="lblMovesLeft" runat="server" Font-Bold ="true" Text="Moves"></asp:Label>
                                &nbsp;&nbsp;&nbsp;
                                <asp:Label ID="Label3" runat="server" Text="Shots: "></asp:Label>
                                &nbsp;&nbsp;&nbsp;
                                <asp:Label ID="lblShootsLeft" runat="server" Font-Bold ="true" Text="Shoots"></asp:Label>
                                <br />
                                <asp:Label ID="Label4" runat="server" Text="Health: "></asp:Label>
                                &nbsp;&nbsp;&nbsp;
                                <asp:Label ID="lblHealth" runat="server" Text="Healths"></asp:Label>
                                <br />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:Label ID="Label6" runat="server" Text="Currently playing the game:"></asp:Label><br />
                        <asp:Repeater ID="UserRepeater" runat="server">
                        <ItemTemplate>
                            <span>
                            <cc1:ProfilePic ID="ProfilePic1" Uid='<%# Eval("Uid") %>' linked="true" runat="server">
                            </cc1:ProfilePic>
                            </span>
                            </ItemTemplate>
                        </asp:Repeater>
                        <br />
                        <br />
                         <asp:UpdatePanel ID="upnlFinish" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Button ID="FinishTurn" runat="server" Enabled="False" OnClick="FinishTurn_Click"
                                    Text="Finish Turn" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <asp:UpdatePanel ID="upnlUndoRedo" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <asp:Button ID="btnUndo" runat="server" Enabled="False" Text="Undo" OnClick="btnUndo_Click" />
                                <asp:Button ID="btnRedo" runat="server" Enabled="False" OnClick="btnRedo_Click" Text="Redo" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <br />
                        <div>
                        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID = "upnlBoard">
                           <ProgressTemplate>
                            Processing...
                           </ProgressTemplate>
                        </asp:UpdateProgress>
                        </div>
                        <br />
                    </asp:TableCell>
                </asp:TableRow>
            <asp:TableRow>
            <asp:TableCell ColumnSpan = "2">
            <asp:UpdatePanel ID="upnlMessages" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:ListBox ID="Messages" runat="server" Width = "100%"></asp:ListBox>
                    <asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="1000" OnTick="Timer1_Tick">
                    </asp:Timer>
                    <br />
                </ContentTemplate>
            </asp:UpdatePanel>
            </asp:TableCell>
            </asp:TableRow>
            </asp:Table>
        </div>
    </asp:Panel>
    <asp:UpdatePanel ID="UpnlGameOver" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="Panel3" runat="server" HorizontalAlign="Center" style="border-style:solid; height:150; width:400; background-color:White; position:absolute; top:50%; left:40%; z-index:110" Visible="false">
                <asp:Label ID="lblGameOver" runat="server" Text="Label" Visible="False"></asp:Label>
                <br />
                <asp:Button ID="btnContinue" runat="server" Text="Continue" OnClick="btnContinue_Click"
                    Visible="False" />
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
    
    
    
    <div id="popdiv"  style="visibility:hidden; background-color:#FAFAFA;  position:fixed; border-style:solid; background-color:White; width:120px; height:180px; z-index:120; top:10%; right:10%" align="center">
        <table style="width: 100%; height: 150px;">
            <tr>
                <td><label id="plblName">Name</label></td>
                <td>
                    <img id="popimg" alt="." src="BoardWebControl/Graphics/soldier_brown.gif" 
                        style="background-image: none;" />
                </td>
            </tr>
            <tr>
                <td><label id="plblHealthTag">health</label></td>
                <td><label id="plblHealthVal">x</label></td>
            </tr>
            <tr>
                <td><label id="plblSpeedTag">Speed</label></td>
                <td><label id="plblSpeedVal">x</label></td>
            </tr>
            <tr>
                <td><label id="plblAccTag">Accuracy</label></td>
                <td><label id="plblAccVal">x</label></td>
            </tr>
        </table>
     </div>
       
    
          
    <script type="text/javascript" src="BoardWebControl/JS/jquery.js"></script>
    <script type="text/javascript">
        function tile_over (tile)
        {              
              popdiv.style.visibility = "visible";
              $('#popimg').attr("src",tile.attr("src"));
              plblName.innerHTML = tile.attr("playerName");
              plblSpeedVal.innerHTML = tile.attr("playerHlt");
              plblHealthVal.innerHTML = tile.attr("playerSpd");
              plblAccVal.innerHTML = tile.attr("playerAcc");
              $('#popdiv').fadeIn('slow');
        }
        
        function tile_out (tile)
        {
            $('#popdiv').fadeOut('fast');
        }
         
        $(document).ready( function(){
            $('[hasPlayer=1]').live( 'mouseenter', function(event) { tile_over($(this)); } );
            $('[hasPlayer=1]').live( 'mouseleave', function(event) { tile_out($(this)); } );
             
        }); 
        
            
    </script>
 

</asp:Content>
    
  